using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Physics_Hurt : MonoBehaviour
{
    private float HurtCD = 0;
    private float Hurttime = 1f;
    private float Atk_EnemyPhy;
    // Start is called before the first frame update
    private void Awake()
    {
        if (gameObject.transform.parent.parent.parent.parent.name == "Enemy2(Clone)" || gameObject.transform.parent.parent.parent.parent.name == "Enemy2")
        {
            Atk_EnemyPhy = 8;
        }
        else if (gameObject.transform.parent.parent.parent.parent.name == "Enemy5(Clone)" || gameObject.transform.parent.parent.parent.parent.name == "Enemy5")
        {
            Atk_EnemyPhy = 10;
        }
        else if (gameObject.transform.parent.parent.parent.parent.name == "Enemy6(Clone)" || gameObject.transform.parent.parent.parent.parent.name == "Enemy6")
        {
            Atk_EnemyPhy = 12;
        }
        else if (gameObject.transform.parent.parent.parent.parent.name == "Enemy7(Clone)" || gameObject.transform.parent.parent.parent.parent.name == "Enemy7")
        {
            Atk_EnemyPhy = 10;
        }
    }
    // Update is called once per frame
    void Update()
    {
    
        HurtCD -= Time.deltaTime;
       
    }
    private void OnTriggerEnter(Collider other)
    {
        
        if (other.gameObject.tag == "Player"&&HurtCD<0)
        {
            HurtCD = Hurttime;
            other.gameObject.GetComponent<Player_Control>().GetHurt(Atk_EnemyPhy);

        }
    }
}
